Integrand size = 33, antiderivative size = 82 \[ \int \frac {\left (1-\cos ^2(c+d x)\right ) \sec ^2(c+d x)}{a+b \cos (c+d x)} \, dx=-\frac {2 \sqrt {a-b} \sqrt {a+b} \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 d}-\frac {b \text {arctanh}(\sin (c+d x))}{a^2 d}+\frac {\tan (c+d x)}{a d} \]
-b*arctanh(sin(d*x+c))/a^2/d-2*arctan((a-b)^(1/2)*tan(1/2*d*x+1/2*c)/(a+b) ^(1/2))*(a-b)^(1/2)*(a+b)^(1/2)/a^2/d+tan(d*x+c)/a/d
Time = 0.51 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.37 \[ \int \frac {\left (1-\cos ^2(c+d x)\right ) \sec ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\frac {-2 \sqrt {-a^2+b^2} \text {arctanh}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )+b \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+a \tan (c+d x)}{a^2 d} \]
(-2*Sqrt[-a^2 + b^2]*ArcTanh[((a - b)*Tan[(c + d*x)/2])/Sqrt[-a^2 + b^2]] + b*(Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] - Log[Cos[(c + d*x)/2] + Sin [(c + d*x)/2]]) + a*Tan[c + d*x])/(a^2*d)
Time = 0.56 (sec) , antiderivative size = 96, normalized size of antiderivative = 1.17, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {3042, 3535, 25, 3042, 3480, 3042, 3138, 218, 4257}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\left (1-\cos ^2(c+d x)\right ) \sec ^2(c+d x)}{a+b \cos (c+d x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {1-\sin \left (c+d x+\frac {\pi }{2}\right )^2}{\sin \left (c+d x+\frac {\pi }{2}\right )^2 \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right )}dx\) |
\(\Big \downarrow \) 3535 |
\(\displaystyle \frac {\int -\frac {(b+a \cos (c+d x)) \sec (c+d x)}{a+b \cos (c+d x)}dx}{a}+\frac {\tan (c+d x)}{a d}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {\tan (c+d x)}{a d}-\frac {\int \frac {(b+a \cos (c+d x)) \sec (c+d x)}{a+b \cos (c+d x)}dx}{a}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\tan (c+d x)}{a d}-\frac {\int \frac {b+a \sin \left (c+d x+\frac {\pi }{2}\right )}{\sin \left (c+d x+\frac {\pi }{2}\right ) \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right )}dx}{a}\) |
\(\Big \downarrow \) 3480 |
\(\displaystyle \frac {\tan (c+d x)}{a d}-\frac {\frac {\left (a^2-b^2\right ) \int \frac {1}{a+b \cos (c+d x)}dx}{a}+\frac {b \int \sec (c+d x)dx}{a}}{a}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\tan (c+d x)}{a d}-\frac {\frac {\left (a^2-b^2\right ) \int \frac {1}{a+b \sin \left (c+d x+\frac {\pi }{2}\right )}dx}{a}+\frac {b \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{a}}{a}\) |
\(\Big \downarrow \) 3138 |
\(\displaystyle \frac {\tan (c+d x)}{a d}-\frac {\frac {2 \left (a^2-b^2\right ) \int \frac {1}{(a-b) \tan ^2\left (\frac {1}{2} (c+d x)\right )+a+b}d\tan \left (\frac {1}{2} (c+d x)\right )}{a d}+\frac {b \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{a}}{a}\) |
\(\Big \downarrow \) 218 |
\(\displaystyle \frac {\tan (c+d x)}{a d}-\frac {\frac {b \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{a}+\frac {2 \left (a^2-b^2\right ) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a d \sqrt {a-b} \sqrt {a+b}}}{a}\) |
\(\Big \downarrow \) 4257 |
\(\displaystyle \frac {\tan (c+d x)}{a d}-\frac {\frac {2 \left (a^2-b^2\right ) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a d \sqrt {a-b} \sqrt {a+b}}+\frac {b \text {arctanh}(\sin (c+d x))}{a d}}{a}\) |
-(((2*(a^2 - b^2)*ArcTan[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/(a*S qrt[a - b]*Sqrt[a + b]*d) + (b*ArcTanh[Sin[c + d*x]])/(a*d))/a) + Tan[c + d*x]/(a*d)
3.6.98.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d) Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 - b^2, 0]
Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])/(((a_.) + (b_.)*sin[(e_.) + (f_ .)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])), x_Symbol] :> Simp[(A*b - a*B)/(b*c - a*d) Int[1/(a + b*Sin[e + f*x]), x], x] + Simp[(B*c - A*d)/ (b*c - a*d) Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f , A, B}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-(A*b^2 + a^2*C))*Cos[e + f*x]*(a + b*Sin[e + f*x])^(m + 1)*((c + d*S in[e + f*x])^(n + 1)/(f*(m + 1)*(b*c - a*d)*(a^2 - b^2))), x] + Simp[1/((m + 1)*(b*c - a*d)*(a^2 - b^2)) Int[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin [e + f*x])^n*Simp[a*(m + 1)*(b*c - a*d)*(A + C) + d*(A*b^2 + a^2*C)*(m + n + 2) - (c*(A*b^2 + a^2*C) + b*(m + 1)*(b*c - a*d)*(A + C))*Sin[e + f*x] - d *(A*b^2 + a^2*C)*(m + n + 3)*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && LtQ[m, -1] && ((EqQ[a, 0] && IntegerQ[m] && !IntegerQ[n]) || !(IntegerQ[2*n] && LtQ[n, -1] && ((IntegerQ[n] && !IntegerQ[m]) || EqQ[a, 0])))
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]
Time = 2.58 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.57
method | result | size |
derivativedivides | \(\frac {\frac {2 \left (-a^{2}+b^{2}\right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {1}{a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a^{2}}-\frac {1}{a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a^{2}}}{d}\) | \(129\) |
default | \(\frac {\frac {2 \left (-a^{2}+b^{2}\right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {1}{a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a^{2}}-\frac {1}{a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a^{2}}}{d}\) | \(129\) |
risch | \(\frac {2 i}{d a \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{a^{2} d}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{a^{2} d}+\frac {\sqrt {-a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i \sqrt {-a^{2}+b^{2}}+a}{b}\right )}{d \,a^{2}}-\frac {\sqrt {-a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i \sqrt {-a^{2}+b^{2}}-a}{b}\right )}{d \,a^{2}}\) | \(169\) |
1/d*(2/a^2*(-a^2+b^2)/((a-b)*(a+b))^(1/2)*arctan((a-b)*tan(1/2*d*x+1/2*c)/ ((a-b)*(a+b))^(1/2))-1/a/(tan(1/2*d*x+1/2*c)-1)+b/a^2*ln(tan(1/2*d*x+1/2*c )-1)-1/a/(tan(1/2*d*x+1/2*c)+1)-b/a^2*ln(tan(1/2*d*x+1/2*c)+1))
Time = 0.32 (sec) , antiderivative size = 297, normalized size of antiderivative = 3.62 \[ \int \frac {\left (1-\cos ^2(c+d x)\right ) \sec ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\left [-\frac {b \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - b \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) - \sqrt {-a^{2} + b^{2}} \cos \left (d x + c\right ) \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) - 2 \, a \sin \left (d x + c\right )}{2 \, a^{2} d \cos \left (d x + c\right )}, -\frac {b \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - b \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) \cos \left (d x + c\right ) - 2 \, a \sin \left (d x + c\right )}{2 \, a^{2} d \cos \left (d x + c\right )}\right ] \]
[-1/2*(b*cos(d*x + c)*log(sin(d*x + c) + 1) - b*cos(d*x + c)*log(-sin(d*x + c) + 1) - sqrt(-a^2 + b^2)*cos(d*x + c)*log((2*a*b*cos(d*x + c) + (2*a^2 - b^2)*cos(d*x + c)^2 + 2*sqrt(-a^2 + b^2)*(a*cos(d*x + c) + b)*sin(d*x + c) - a^2 + 2*b^2)/(b^2*cos(d*x + c)^2 + 2*a*b*cos(d*x + c) + a^2)) - 2*a* sin(d*x + c))/(a^2*d*cos(d*x + c)), -1/2*(b*cos(d*x + c)*log(sin(d*x + c) + 1) - b*cos(d*x + c)*log(-sin(d*x + c) + 1) + 2*sqrt(a^2 - b^2)*arctan(-( a*cos(d*x + c) + b)/(sqrt(a^2 - b^2)*sin(d*x + c)))*cos(d*x + c) - 2*a*sin (d*x + c))/(a^2*d*cos(d*x + c))]
\[ \int \frac {\left (1-\cos ^2(c+d x)\right ) \sec ^2(c+d x)}{a+b \cos (c+d x)} \, dx=- \int \left (- \frac {\sec ^{2}{\left (c + d x \right )}}{a + b \cos {\left (c + d x \right )}}\right )\, dx - \int \frac {\cos ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{a + b \cos {\left (c + d x \right )}}\, dx \]
-Integral(-sec(c + d*x)**2/(a + b*cos(c + d*x)), x) - Integral(cos(c + d*x )**2*sec(c + d*x)**2/(a + b*cos(c + d*x)), x)
Exception generated. \[ \int \frac {\left (1-\cos ^2(c+d x)\right ) \sec ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\text {Exception raised: ValueError} \]
Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?` f or more de
Leaf count of result is larger than twice the leaf count of optimal. 150 vs. \(2 (73) = 146\).
Time = 0.32 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.83 \[ \int \frac {\left (1-\cos ^2(c+d x)\right ) \sec ^2(c+d x)}{a+b \cos (c+d x)} \, dx=-\frac {\frac {b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} - \frac {b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}} - \frac {2 \, {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )} \sqrt {a^{2} - b^{2}}}{a^{2}} + \frac {2 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} a}}{d} \]
-(b*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a^2 - b*log(abs(tan(1/2*d*x + 1/2*c ) - 1))/a^2 - 2*(pi*floor(1/2*(d*x + c)/pi + 1/2)*sgn(-2*a + 2*b) + arctan (-(a*tan(1/2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c))/sqrt(a^2 - b^2)))*sqrt (a^2 - b^2)/a^2 + 2*tan(1/2*d*x + 1/2*c)/((tan(1/2*d*x + 1/2*c)^2 - 1)*a)) /d
Time = 1.71 (sec) , antiderivative size = 436, normalized size of antiderivative = 5.32 \[ \int \frac {\left (1-\cos ^2(c+d x)\right ) \sec ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\frac {2\,b\,\mathrm {atanh}\left (\frac {64\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{64\,a\,b-64\,b^2-\frac {64\,b^3}{a}+\frac {64\,b^4}{a^2}}-\frac {64\,b^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{64\,a\,b^2-64\,a^2\,b+64\,b^3-\frac {64\,b^4}{a}}+\frac {64\,b^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{-64\,a^3\,b+64\,a^2\,b^2+64\,a\,b^3-64\,b^4}-\frac {64\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{64\,a\,b-64\,b^2-\frac {64\,b^3}{a}+\frac {64\,b^4}{a^2}}\right )}{a^2\,d}-\frac {2\,\mathrm {atanh}\left (\frac {64\,b^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{64\,a^4-128\,a^3\,b+128\,a\,b^3-64\,b^4}+\frac {192\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{128\,a^2\,b-64\,a^3-128\,b^3+\frac {64\,b^4}{a}}+\frac {64\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{128\,a\,b-64\,a^2-\frac {128\,b^3}{a}+\frac {64\,b^4}{a^2}}-\frac {192\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{128\,a\,b-64\,a^2-\frac {128\,b^3}{a}+\frac {64\,b^4}{a^2}}\right )\,\sqrt {b^2-a^2}}{a^2\,d}-\frac {2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a\,d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \]
(2*b*atanh((64*b^2*tan(c/2 + (d*x)/2))/(64*a*b - 64*b^2 - (64*b^3)/a + (64 *b^4)/a^2) - (64*b^3*tan(c/2 + (d*x)/2))/(64*a*b^2 - 64*a^2*b + 64*b^3 - ( 64*b^4)/a) + (64*b^4*tan(c/2 + (d*x)/2))/(64*a*b^3 - 64*a^3*b - 64*b^4 + 6 4*a^2*b^2) - (64*a*b*tan(c/2 + (d*x)/2))/(64*a*b - 64*b^2 - (64*b^3)/a + ( 64*b^4)/a^2)))/(a^2*d) - (2*atanh((64*b^3*tan(c/2 + (d*x)/2)*(b^2 - a^2)^( 1/2))/(128*a*b^3 - 128*a^3*b + 64*a^4 - 64*b^4) + (192*b^2*tan(c/2 + (d*x) /2)*(b^2 - a^2)^(1/2))/(128*a^2*b - 64*a^3 - 128*b^3 + (64*b^4)/a) + (64*a *tan(c/2 + (d*x)/2)*(b^2 - a^2)^(1/2))/(128*a*b - 64*a^2 - (128*b^3)/a + ( 64*b^4)/a^2) - (192*b*tan(c/2 + (d*x)/2)*(b^2 - a^2)^(1/2))/(128*a*b - 64* a^2 - (128*b^3)/a + (64*b^4)/a^2))*(b^2 - a^2)^(1/2))/(a^2*d) - (2*tan(c/2 + (d*x)/2))/(a*d*(tan(c/2 + (d*x)/2)^2 - 1))